/*
 * pcb.h
 *
 *  Created on: Feb 29, 2012
 *      Author: Christian
 */


#ifndef PCB_H_
#define PCB_H_

#include "enum_process_state.h"
#include "enum_request_type.h"

typedef struct pcb_str {
	int pid;
	int next_step;				//step count that cpu has gotten to when process was prempted (like a PC register value)
	p_state state;				//0=RUNNING, 1=BLOCKED (waiting on inter-process communication), 2=RUNNABLE
	request_type waiting_on;	//0=KEYBOARD, 1=AUXILIARY, 2=NONE
//	int waiting_on;				//which I/O queue it is in if it is blocked
	int owns;					//which semaphore does it own?
} pcb;

/**
 * PCB constructor.
 */
pcb* pcb_new(const int pid);

void pcb_set_runnable(pcb* pcb);

void pcb_set_blocked(pcb* pcb, const int waiting_on);

#endif /* PCB_H_ */
